#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>


int main(){
   int fd1 = open("a.txt", O_CREAT|O_RDWR, 0665);
   if(fd1 < 2) {
      perror("open");
      return -1;
   }

   printf("文件打开成功!\n");

   int arr[3] = {1, 2, 3};
   ssize_t wlen = write(fd1, arr, sizeof(int)*3);
   printf("write len %ld\n", wlen);

   close(fd1);

   return 0;
}
